package com.andryu.jni.module

import com.andryu.base.constant.CommonConstants
import com.andryu.base.entity.LearnListEntity
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Named
import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
object NdkModule {
    @Provides
    @Singleton
    @Named("ndkList")
    fun provideNdkList(): MutableList<LearnListEntity> {
        val mDataList = mutableListOf<LearnListEntity>()
        mDataList.add(LearnListEntity("JNI基本使用-CPP篇", CommonConstants.LEARN_INFO_TITLE))
        mDataList.add(LearnListEntity("JNI-Simple 使用", CommonConstants.LEARN_INFO_CONTENT, "jni基本使用，java与cpp相互调用"))
        return mDataList
    }

    @Provides
    @Singleton
    @Named("NdkLastThree")
    fun provideOpenglTopThree(): List<LearnListEntity> {
        return provideNdkList()
            .filter { it.type == CommonConstants.LEARN_INFO_CONTENT }
            .reversed()
            .take(3)
    }
}